﻿//********************************************************************************//
//创建日期：<创建日期，2016-02-26>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：打印账单,托单,一般或集中汇缴书
//废弃 已用DaYinZDDBS.aspx替代
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using Web.Class;

namespace Web.Pages.QuShui
{
    public partial class DaYinZDTD : BasePage
    {
        #region 属性

        /// <summary>
        /// 当前操作项ID
        /// </summary>
        private int JuXinXID
        {
            get
            {
                return Convert.ToInt32(ViewState["_JuXinXID"]);
            }
            set
            {
                ViewState["_JuXinXID"] = value;
            }
        }

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSource"] as DataTable;
            }
            set
            {
                ViewState["dtSource"] = value;
            }
        }

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource2
        {
            get
            {
                return ViewState["dtSource2"] as DataTable;
            }
            set
            {
                ViewState["dtSource2"] = value;
            }
        }

        #endregion

        #region 变量

        /// <summary>
        /// 局信息对象
        /// </summary>
        YS_JX_JUXINX _YS_JX_JUXINX = new YS_JX_JUXINX();

        /// <summary>
        /// 局信息BLL
        /// </summary>
        YS_JX_JUXINXBLL _YS_JX_JUXINXBLL = new YS_JX_JUXINXBLL();

        /// <summary>
        /// 操作日志BLL
        /// </summary>
        SYS_LOGBLL _SYS_LOGBLL = new SYS_LOGBLL();

        #endregion

        #region 事件

        /// <summary>
        /// 页面加载
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitControl();
                InitData();                
            }
            LoadData();
        }

        /// <summary>
        /// 列表1查询
        /// </summary>
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (this.txtYM.Text.Trim() == "")
            {
                this.dtSource = null;
            }
            else
            {
                this.dtSource = new SpHelper().P_QS_KAIZHANGZDHQ(int.Parse(this.txtYM.Text)).Tables[0];
            }
            LoadData();
        }

        /// <summary>
        /// 列表2查询
        /// </summary>
        protected void tab2btnSearch_Click(object sender, EventArgs e)
        {
            if (this.txtYM2.Text.Trim() == "")
            {
                this.dtSource2 = null;
            }
            else
            {
                this.dtSource2 = new QS_ZW_BUSHOU2BLL().SelectQS_ZW_BUSHOU2sDynamic("I_JLZT=0 AND I_WTYPE="+BusinessTool.WType, null);
            }
            LoadData2();
        }

        /// <summary>
        /// 响应前台回调
        /// </summary>
        protected void ASPxCallback1_Callback(object source, DevExpress.Web.CallbackEventArgs e)
        {
            CallbackResult cr = new CallbackResult(e.Parameter);
            if (e.Parameter == "goto1")
            {
                string conBH = this.tab1YongHuH1.Text.Trim();
                int findIndex = PageTools.SearchRecordIndex(this.dtSource, this.gvList1, "S_YONGHUH", conBH, false);
                if (findIndex == -1)
                {
                    cr.IsSuccess = false;
                    cr.IsAlertMsg = true;
                    cr.Msg = "未找到对应数据！";
                    e.Result = cr.ToString();
                    return;
                }
                else
                {
                    cr.IsSuccess = true;
                    cr.IsAlertMsg = false;
                    cr.SpecialIndetity = findIndex.ToString();
                    e.Result = cr.ToString();
                    return;
                }
            }
            else if (e.Parameter == "goto2")
            {
                string conBH = this.tab2YongHuH1.Text.Trim();
                int findIndex = PageTools.SearchRecordIndex(this.dtSource2, this.gvList2, "S_YONGHUH", conBH, false);
                if (findIndex == -1)
                {
                    cr.IsSuccess = false;
                    cr.IsAlertMsg = true;
                    cr.Msg = "未找到对应数据！";
                    e.Result = cr.ToString();
                    return;
                }
                else
                {
                    cr.IsSuccess = true;
                    cr.IsAlertMsg = false;
                    cr.SpecialIndetity = findIndex.ToString();
                    e.Result = cr.ToString();
                    return;
                }
            }
        }

        #endregion

        #region 方法

        /// <summary>
        /// 初始化控件
        /// </summary>
        private void InitControl()
        {
            
        }

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            
        }

        /// <summary>
        /// 数据加载
        /// </summary>
        private void LoadData()
        {
            this.gvList1.DataSource = this.dtSource;
            this.gvList1.DataBind();
        }

        /// <summary>
        /// 数据加载
        /// </summary>
        private void LoadData2()
        {
            this.gvList2.DataSource = this.dtSource2;
            this.gvList2.DataBind();
        }

        #endregion

    }
}